<h1>Listing users</h1>

<table>
  <tr>
    <th>Uname</th>
    <th>Passwd</th>
    <th>Email</th>
    <th>Utype</th>
  </tr>

<% @users.each do |user| %>
  <tr>
    <td><%= link_to user.uname, user %></td>
    <td><%= user.passwd %></td>
    <td><%= user.email %></td>
    <td><%= user.utype %></td>
  <% if current_user.privilege == 3 %>
    <td>
      <%= link_to 'Edit', edit_user_path(user) %>
      <%= link_to 'Destroy', user,
                  :confirm => 'Are you sure?',
                  :method => :delete %>
    </td>
  <% end %>
  </tr>
<% end %>
</table>

<br />

<% if current_user.privilege == 3 %>
<%= link_to 'New user', new_user_path %>
<% end %>
